using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace LS.GameSystem
{
    public interface IGameSystemManager
    {
        /// <summary>
        /// 注册系统
        /// </summary>
        /// <param name="system"></param>
        void RegisterSystem(GameSystemBase system);

        T RegisterSystem<T>(string name) where T : GameSystemBase, new();

        GameSystemBase RegisterSystem(Type systemType, string name);

        /// <summary>
        /// 移除系统
        /// </summary>
        /// <param name="controller"></param>
        void RemoveSystem(GameSystemBase controller);

        void RemoveSystem<T>(string name) where T : GameSystemBase, new();

        void RemoveSystem(Type controllerType, string name);

        bool HasSystem(GameSystemBase system);

        bool HasSystem<T>(string name) where T : GameSystemBase, new();

        /// <summary>
        /// 获取系统
        /// </summary>
        /// <param name="systemType"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        GameSystemBase GetSystem(Type systemType, string name);

        T GetSystem<T>(string name) where T : GameSystemBase, new();

        GameSystemBase[] GetAllSystems();
        
        /// <summary>
        /// 每帧轮询
        /// </summary>
        /// <param name="deltaSeconds"></param>
        /// <param name="realDeltaSeconds"></param>
        void Update(float deltaSeconds, float realDeltaSeconds);

        /// <summary>
        /// 固定间隔轮询，主要用于物理更新
        /// </summary>
        /// <param name="fixedDeltaSeconds"></param>
        /// <param name="realFixedDeltaSeconds"></param>
        void FixedUpdate(float fixedDeltaSeconds, float realFixedDeltaSeconds);

        /// <summary>
        /// 每秒轮询
        /// </summary>
        /// <param name="seconds"></param>
        void UpdateSeconds(int seconds);

        /// <summary>
        /// 按照真实秒数轮询
        /// </summary>
        /// <param name="realSeconds"></param>
        void UpdateRealSeconds(int realSeconds);

        /// <summary>
        /// 关闭
        /// </summary>
        void Shutdown();
    }
}